package tools

import (
	"fmt"
	"strconv"
	"time"
)

// 记录方法耗时
func TimeSpend(funcName string) func() {
	now := time.Now().Nanosecond() / 1000000
	return func() {
		after := time.Now().Nanosecond() / 1000000
		fmt.Printf("%s const %d ms\n", funcName, after-now)
	}
}

type User struct {
	Age  int
	Name string
	string
	int
}

// 实现ToString方法
func (u User) String() string {
	return u.Name + ":" + strconv.Itoa(u.Age)
}
